package DesignPatterns.Singleton;

//懒汉式
//从时间空间上看：以时间换空间
//从线程安全上看：不安全的（所以要加锁synchronized）
public class Singleton2 {
    private static Singleton2 INSTANCE;

    private Singleton2() {

    }

    public synchronized static Singleton2 getInstance() {
        if (INSTANCE == null) {
            INSTANCE = new Singleton2();
        }
        return INSTANCE;
    }
}
